treexml
: An XML Tree Library for Rust
treexml
is a simple element-tree style library for XML data.
Usage
Like most rust
packages, treexml
uses cargo.
To use treexml
, add the following to your project's Cargo.toml
[]
= "0.2"
The package exposes a crate named treexml
.
extern crate treexml;
Reading XML Data
Assuming r
is something that implements std::io::Read
:
extern crate treexml;
use Document;
Writing XML Data
extern crate treexml;
use treexml::{Document, Element};
fn main() {
let mut root = Element::new("root");
let mut child = Element::new("child");
child.text = Some("contents".to_owned());
root.children.push(child);
let doc = Document{
root: Some(root),
.. Document::default()
};
println!("{}", doc);
}
Contributing
This project is licensed under the MIT license.
If you encounter any issues, please file them on the GitHub issue tracker at https://github.com/rahulg/treexml/issues.